using System;

using VirtualTournaments.DataAccess.SqlServer.Connections;
using VirtualTournaments.DataAccess.SqlServer.DataProxies;

namespace VirtualTournaments.DataAccess.SqlServer
{
	internal abstract partial class VirtualTournamentsDataContext
	{
		#region Singleton implementation

		private class VirtualTournamentsDataContextImpl : VirtualTournamentsDataContext
		{
			internal VirtualTournamentsDataContextImpl() :
				base(ConnectionManager.GetConnection())
			{
			}
		}

		private static VirtualTournamentsDataContext _instance = null;
		private static readonly object _instanceLocker = new object();

		public static VirtualTournamentsDataContext Instance
		{
			get
			{
				if (_instance == null)
				{
					lock (_instanceLocker)
					{
						if (_instance == null)
						{
							_instance = new VirtualTournamentsDataContextImpl();
						}
					}
				}
				return _instance;
			}
		}

		#endregion
	}

	internal sealed partial class Tournament : IDataObject
	{
		#region IDataObject Members

		public int Id { get { return this.TournamentId; } }

		#endregion
	}

	internal sealed partial class Team : IDataObject
	{
		#region IDataObject Members

		public int Id { get { return this.TeamId; } }

		#endregion
	}

	internal sealed partial class Journey : IDataObject
	{
		#region IDataObject Members

		public int Id { get { return this.JourneyId; } }

		#endregion
	}

	internal sealed partial class Match : IDataObject
	{
		#region IDataObject Members

		public int Id { get { return this.MatchId; } }

		#endregion
	}

	internal sealed partial class User : IDataObject
	{
		#region IDataObject Members

		public int Id { get { return this.UserId; } }

		#endregion
	}

	internal sealed partial class BetType : IDataObject
	{
		#region IDataObject Members

		public int Id { get { return this.BetTypeId; } }

		#endregion
	}

	internal sealed partial class ThreeWaysBetTarget : IDataObject
	{
		#region IDataObject Members

		public int Id { get { return this.ThreeWaysBetTargetId; } }

		#endregion
	}

	internal sealed partial class Bet : IDataObject
	{
		#region IDataObject Members

		public int Id { get { return this.BetId; } }

		#endregion
	}

	internal sealed partial class Player : IDataObject
	{
		#region IDataObject Members

		public int Id { get { return this.PlayerId; } }

		#endregion
	}

	internal sealed partial class TournamentPodiumBetTarget : IDataObject
	{
		#region IDataObject Members

		public int Id { get { return this.TournamentPodiumBetTargetId; } }

		#endregion
	}
}
